// Get base url
url = document.location.href;
xend = url.lastIndexOf("/") + 1;
var base_url = url.substring(0, xend);

// TODO dynamically determine the base URL
//base_url = "http://dev.greenletters.com/music-band-manager/";

function asynchAction (action, div, extra) {
        // Does URL begin with http?
	url = "asynchAction.php?div=" + div + "&action=" + action + "&" + extra;
        if (url.substring(0, 4) != 'http') {
                url = base_url + url;
        }

        // Create new JS element
        var jsel = document.createElement('SCRIPT');
        jsel.type = 'text/javascript';
        jsel.src = url;


        // Append JS element (therefore executing the 'AJAX' call)
        document.body.appendChild (jsel);
}

function toggleVisibility(blockId)
{
  divObj = document.getElementById(blockId);
  divObj.style.display = (divObj.style.display == 'block' ? 'none' : 'block');

  showDiv = document.getElementById(blockId + 'show');
  if (showDiv != null)
  	showDiv.style.display = (divObj.style.display == 'block' ? 'none' : 'block');
  return false;
}
